@@ -1,3 +1,13 @@
+1.18
+ - Fix set subquery building. Bad use of parenthesis.
+ - Includes an actual test for the set query.
+
+1.17
+ - Small fix in release process
+
+1.16
+ - Adds support for Set GIN queries
+
1.15
- Constructing a KiokuDB directory handle is no longer mandatory, you can
get it from the DBIC schema (domm, nothingmuch)
@@ -1,4 +1,4 @@
-This software is copyright (c) 2010 by Yuval Kogman, Infinity Interactive.
+This software is copyright (c) 2011 by Yuval Kogman, Infinity Interactive.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
@@ -12,7 +12,7 @@ b) the "Artistic License"
--- The GNU General Public License, Version 1, February 1989 ---
-This software is Copyright (c) 2010 by Yuval Kogman, Infinity Interactive.
+This software is Copyright (c) 2011 by Yuval Kogman, Infinity Interactive.
This is free software, licensed under:
@@ -270,7 +270,7 @@ That's all there is to it!
--- The Artistic License 1.0 ---
-This software is Copyright (c) 2010 by Yuval Kogman, Infinity Interactive.
+This software is Copyright (c) 2011 by Yuval Kogman, Infinity Interactive.
This is free software, licensed under:
@@ -26,3 +26,4 @@ t/fixtures.t
t/release-no-tabs.t
t/release-pod-coverage.t
t/release-pod-syntax.t
+t/set_query.t
@@ -4,7 +4,7 @@
"Yuval Kogman"
],
"dynamic_config" : "1",
- "generated_by" : "Dist::Zilla version 4.101612, CPAN::Meta::Converter version 2.101610",
+ "generated_by" : "Dist::Zilla version 4.200000, CPAN::Meta::Converter version 2.102400",
"license" : [
"perl_5"
],
@@ -51,7 +51,7 @@
"MooseX::Types::Moose" : 0,
"SQL::Abstract" : 0,
"Scalar::Util" : 0,
- "Search::GIN" : 0,
+ "Search::GIN" : "0.07",
"Search::GIN::Extract::Delegate" : 0,
"Test::More" : "0.88",
"Test::TempDir" : 0,
@@ -66,11 +66,15 @@
"DBD::SQLite" : 0,
"DBI" : 0,
"KiokuDB::Test" : 0,
+ "Search::GIN::Extract::Callback" : 0,
"Search::GIN::Extract::Class" : 0,
+ "Search::GIN::Query::Manual" : 0,
+ "Search::GIN::Query::Set" : 0,
"Test::Exception" : 0,
"Test::More" : 0,
"Test::TempDir" : 0,
"YAML::XS" : 0,
+ "constant" : 0,
"ok" : 0
}
}
@@ -88,93 +92,93 @@
"web" : "http://github.com/nothingmuch/kiokudb-backend-dbi"
}
},
- "version" : "1.15",
+ "version" : "1.18",
"x_Dist_Zilla" : {
"plugins" : [
{
"class" : "Dist::Zilla::Plugin::GatherDir",
"name" : "@Filter/@Basic/GatherDir",
- "version" : "4.101612"
+ "version" : "4.200000"
},
{
"class" : "Dist::Zilla::Plugin::PruneCruft",
"name" : "@Filter/@Basic/PruneCruft",
- "version" : "4.101612"
+ "version" : "4.200000"
},
{
"class" : "Dist::Zilla::Plugin::ManifestSkip",
"name" : "@Filter/@Basic/ManifestSkip",
- "version" : "4.101612"
+ "version" : "4.200000"
},
{
"class" : "Dist::Zilla::Plugin::MetaYAML",
"name" : "@Filter/@Basic/MetaYAML",
- "version" : "4.101612"
+ "version" : "4.200000"
},
{
"class" : "Dist::Zilla::Plugin::License",
"name" : "@Filter/@Basic/License",
- "version" : "4.101612"
+ "version" : "4.200000"
},
{
"class" : "Dist::Zilla::Plugin::Readme",
"name" : "@Filter/@Basic/Readme",
- "version" : "4.101612"
+ "version" : "4.200000"
},
{
"class" : "Dist::Zilla::Plugin::ExtraTests",
"name" : "@Filter/@Basic/ExtraTests",
- "version" : "4.101612"
+ "version" : "4.200000"
},
{
"class" : "Dist::Zilla::Plugin::ExecDir",
"name" : "@Filter/@Basic/ExecDir",
- "version" : "4.101612"
+ "version" : "4.200000"
},
{
"class" : "Dist::Zilla::Plugin::ShareDir",
"name" : "@Filter/@Basic/ShareDir",
- "version" : "4.101612"
+ "version" : "4.200000"
},
{
"class" : "Dist::Zilla::Plugin::Manifest",
"name" : "@Filter/@Basic/Manifest",
- "version" : "4.101612"
+ "version" : "4.200000"
},
{
"class" : "Dist::Zilla::Plugin::TestRelease",
"name" : "@Filter/@Basic/TestRelease",
- "version" : "4.101612"
+ "version" : "4.200000"
},
{
"class" : "Dist::Zilla::Plugin::ConfirmRelease",
"name" : "@Filter/@Basic/ConfirmRelease",
- "version" : "4.101612"
+ "version" : "4.200000"
},
{
"class" : "Dist::Zilla::Plugin::UploadToCPAN",
"name" : "@Filter/@Basic/UploadToCPAN",
- "version" : "4.101612"
+ "version" : "4.200000"
},
{
"class" : "Dist::Zilla::Plugin::MetaConfig",
"name" : "@Filter/MetaConfig",
- "version" : "4.101612"
+ "version" : "4.200000"
},
{
"class" : "Dist::Zilla::Plugin::MetaJSON",
"name" : "@Filter/MetaJSON",
- "version" : "4.101612"
+ "version" : "4.200000"
},
{
"class" : "Dist::Zilla::Plugin::PkgVersion",
"name" : "@Filter/PkgVersion",
- "version" : "4.101612"
+ "version" : "4.200000"
},
{
"class" : "Dist::Zilla::Plugin::PodSyntaxTests",
"name" : "@Filter/PodSyntaxTests",
- "version" : "4.101612"
+ "version" : "4.200000"
},
{
"class" : "Dist::Zilla::Plugin::NoTabsTests",
@@ -184,22 +188,22 @@
{
"class" : "Dist::Zilla::Plugin::PodCoverageTests",
"name" : "@Filter/PodCoverageTests",
- "version" : "4.101612"
+ "version" : "4.200000"
},
{
"class" : "Dist::Zilla::Plugin::MetaResources",
"name" : "@Filter/MetaResources",
- "version" : "4.101612"
+ "version" : "4.200000"
},
{
"class" : "Dist::Zilla::Plugin::Authority",
"name" : "@Filter/Authority",
- "version" : "1.000"
+ "version" : "1.001"
},
{
- "class" : "Dist::Zilla::Plugin::AutoPrereq",
- "name" : "@Filter/AutoPrereq",
- "version" : "4.101612"
+ "class" : "Dist::Zilla::Plugin::AutoPrereqs",
+ "name" : "@Filter/AutoPrereqs",
+ "version" : "4.200000"
},
{
"class" : "inc::DBICOptionalDeps",
@@ -209,13 +213,13 @@
{
"class" : "Dist::Zilla::Plugin::Prereq",
"config" : {
- "Dist::Zilla::Plugin::Prereq" : {
+ "Dist::Zilla::Plugin::Prereqs" : {
"phase" : "configure",
"type" : "requires"
}
},
"name" : "ConfigureRequires",
- "version" : "4.101612"
+ "version" : "4.200000"
},
{
"class" : "Dist::Zilla::Plugin::InjectMeta",
@@ -225,41 +229,41 @@
{
"class" : "Dist::Zilla::Plugin::Prereq",
"config" : {
- "Dist::Zilla::Plugin::Prereq" : {
+ "Dist::Zilla::Plugin::Prereqs" : {
"phase" : "runtime",
"type" : "requires"
}
},
"name" : "Prereq",
- "version" : "4.101612"
+ "version" : "4.200000"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":InstallModules",
- "version" : "4.101612"
+ "version" : "4.200000"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":TestFiles",
- "version" : "4.101612"
+ "version" : "4.200000"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":ExecFiles",
- "version" : "4.101612"
+ "version" : "4.200000"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":ShareFiles",
- "version" : "4.101612"
+ "version" : "4.200000"
}
],
"zilla" : {
- "class" : "Dist::Zilla",
+ "class" : "Dist::Zilla::Dist::Builder",
"config" : {
"is_trial" : 0
},
- "version" : "4.101612"
+ "version" : "4.200000"
}
},
"x_authority" : "cpan:NUFFIN"
@@ -6,17 +6,21 @@ build_requires:
DBD::SQLite: 0
DBI: 0
KiokuDB::Test: 0
+ Search::GIN::Extract::Callback: 0
Search::GIN::Extract::Class: 0
+ Search::GIN::Query::Manual: 0
+ Search::GIN::Query::Set: 0
Test::Exception: 0
Test::More: 0
Test::TempDir: 0
YAML::XS: 0
+ constant: 0
ok: 0
configure_requires:
DBIx::Class::Optional::Dependencies: 0
ExtUtils::MakeMaker: 6.31
dynamic_config: 1
-generated_by: 'Dist::Zilla version 4.101612, CPAN::Meta::Converter version 2.101610'
+generated_by: 'Dist::Zilla version 4.200000, CPAN::Meta::Converter version 2.102400'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -52,7 +56,7 @@ requires:
MooseX::Types::Moose: 0
SQL::Abstract: 0
Scalar::Util: 0
- Search::GIN: 0
+ Search::GIN: 0.07
Search::GIN::Extract::Delegate: 0
Test::More: 0.88
Test::TempDir: 0
@@ -64,77 +68,77 @@ resources:
bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=KiokuDB-Backend-DBI
homepage: http://search.cpan.org/dist/KiokuDB-Backend-DBI
repository: git://github.com/nothingmuch/kiokudb-backend-dbi.git
-version: 1.15
+version: 1.18
x_Dist_Zilla:
plugins:
-
class: Dist::Zilla::Plugin::GatherDir
name: '@Filter/@Basic/GatherDir'
- version: 4.101612
+ version: 4.200000
-
class: Dist::Zilla::Plugin::PruneCruft
name: '@Filter/@Basic/PruneCruft'
- version: 4.101612
+ version: 4.200000
-
class: Dist::Zilla::Plugin::ManifestSkip
name: '@Filter/@Basic/ManifestSkip'
- version: 4.101612
+ version: 4.200000
-
class: Dist::Zilla::Plugin::MetaYAML
name: '@Filter/@Basic/MetaYAML'
- version: 4.101612
+ version: 4.200000
-
class: Dist::Zilla::Plugin::License
name: '@Filter/@Basic/License'
- version: 4.101612
+ version: 4.200000
-
class: Dist::Zilla::Plugin::Readme
name: '@Filter/@Basic/Readme'
- version: 4.101612
+ version: 4.200000
-
class: Dist::Zilla::Plugin::ExtraTests
name: '@Filter/@Basic/ExtraTests'
- version: 4.101612
+ version: 4.200000
-
class: Dist::Zilla::Plugin::ExecDir
name: '@Filter/@Basic/ExecDir'
- version: 4.101612
+ version: 4.200000
-
class: Dist::Zilla::Plugin::ShareDir
name: '@Filter/@Basic/ShareDir'
- version: 4.101612
+ version: 4.200000
-
class: Dist::Zilla::Plugin::Manifest
name: '@Filter/@Basic/Manifest'
- version: 4.101612
+ version: 4.200000
-
class: Dist::Zilla::Plugin::TestRelease
name: '@Filter/@Basic/TestRelease'
- version: 4.101612
+ version: 4.200000
-
class: Dist::Zilla::Plugin::ConfirmRelease
name: '@Filter/@Basic/ConfirmRelease'
- version: 4.101612
+ version: 4.200000
-
class: Dist::Zilla::Plugin::UploadToCPAN
name: '@Filter/@Basic/UploadToCPAN'
- version: 4.101612
+ version: 4.200000
-
class: Dist::Zilla::Plugin::MetaConfig
name: '@Filter/MetaConfig'
- version: 4.101612
+ version: 4.200000
-
class: Dist::Zilla::Plugin::MetaJSON
name: '@Filter/MetaJSON'
- version: 4.101612
+ version: 4.200000
-
class: Dist::Zilla::Plugin::PkgVersion
name: '@Filter/PkgVersion'
- version: 4.101612
+ version: 4.200000
-
class: Dist::Zilla::Plugin::PodSyntaxTests
name: '@Filter/PodSyntaxTests'
- version: 4.101612
+ version: 4.200000
-
class: Dist::Zilla::Plugin::NoTabsTests
name: '@Filter/NoTabsTests'
@@ -142,19 +146,19 @@ x_Dist_Zilla:
-
class: Dist::Zilla::Plugin::PodCoverageTests
name: '@Filter/PodCoverageTests'
- version: 4.101612
+ version: 4.200000
-
class: Dist::Zilla::Plugin::MetaResources
name: '@Filter/MetaResources'
- version: 4.101612
+ version: 4.200000
-
class: Dist::Zilla::Plugin::Authority
name: '@Filter/Authority'
- version: 1.000
+ version: 1.001
-
- class: Dist::Zilla::Plugin::AutoPrereq
- name: '@Filter/AutoPrereq'
- version: 4.101612
+ class: Dist::Zilla::Plugin::AutoPrereqs
+ name: '@Filter/AutoPrereqs'
+ version: 4.200000
-
class: inc::DBICOptionalDeps
name: '=inc::DBICOptionalDeps'
@@ -162,11 +166,11 @@ x_Dist_Zilla:
-
class: Dist::Zilla::Plugin::Prereq
config:
- Dist::Zilla::Plugin::Prereq:
+ Dist::Zilla::Plugin::Prereqs:
phase: configure
type: requires
name: ConfigureRequires
- version: 4.101612
+ version: 4.200000
-
class: Dist::Zilla::Plugin::InjectMeta
name: InjectMeta
@@ -174,30 +178,30 @@ x_Dist_Zilla:
-
class: Dist::Zilla::Plugin::Prereq
config:
- Dist::Zilla::Plugin::Prereq:
+ Dist::Zilla::Plugin::Prereqs:
phase: runtime
type: requires
name: Prereq
- version: 4.101612
+ version: 4.200000
-
class: Dist::Zilla::Plugin::FinderCode
name: ':InstallModules'
- version: 4.101612
+ version: 4.200000
-
class: Dist::Zilla::Plugin::FinderCode
name: ':TestFiles'
- version: 4.101612
+ version: 4.200000
-
class: Dist::Zilla::Plugin::FinderCode
name: ':ExecFiles'
- version: 4.101612
+ version: 4.200000
-
class: Dist::Zilla::Plugin::FinderCode
name: ':ShareFiles'
- version: 4.101612
+ version: 4.200000
zilla:
- class: Dist::Zilla
+ class: Dist::Zilla::Dist::Builder
config:
is_trial: 0
- version: 4.101612
+ version: 4.200000
x_authority: cpan:NUFFIN
@@ -12,11 +12,15 @@ my %WriteMakefileArgs = (
'DBD::SQLite' => '0',
'DBI' => '0',
'KiokuDB::Test' => '0',
+ 'Search::GIN::Extract::Callback' => '0',
'Search::GIN::Extract::Class' => '0',
+ 'Search::GIN::Query::Manual' => '0',
+ 'Search::GIN::Query::Set' => '0',
'Test::Exception' => '0',
'Test::More' => '0',
'Test::TempDir' => '0',
'YAML::XS' => '0',
+ 'constant' => '0',
'ok' => '0'
},
'CONFIGURE_REQUIRES' => {
@@ -57,7 +61,7 @@ my %WriteMakefileArgs = (
'MooseX::Types::Moose' => '0',
'SQL::Abstract' => '0',
'Scalar::Util' => '0',
- 'Search::GIN' => '0',
+ 'Search::GIN' => '0.07',
'Search::GIN::Extract::Delegate' => '0',
'Test::More' => '0.88',
'Test::TempDir' => '0',
@@ -66,7 +70,7 @@ my %WriteMakefileArgs = (
'namespace::autoclean' => '0',
'namespace::clean' => '0'
},
- 'VERSION' => '1.15',
+ 'VERSION' => '1.18',
'test' => {
'TESTS' => 't/*.t'
}
@@ -75,7 +79,7 @@ my %WriteMakefileArgs = (
unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
- my $pp = $WriteMakefileArgs{PREREQ_PM};
+ my $pp = $WriteMakefileArgs{PREREQ_PM};
for my $mod ( keys %$br ) {
if ( exists $pp->{$mod} ) {
$pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
@@ -1,11 +1,11 @@
This archive contains the distribution KiokuDB-Backend-DBI,
-version 1.15:
+version 1.18:
L<DBI> backend for L<KiokuDB>
-This software is copyright (c) 2010 by Yuval Kogman, Infinity Interactive.
+This software is copyright (c) 2011 by Yuval Kogman, Infinity Interactive.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
@@ -1,5 +1,5 @@
name = KiokuDB-Backend-DBI
-version = 1.15
+version = 1.18
author = Yuval Kogman
license = Perl_5
copyright_holder = Yuval Kogman, Infinity Interactive
@@ -37,4 +37,4 @@ Test::More = 0.88
Test::TempDir = 0
SQL::Abstract = 0
-Search::GIN = 0
+Search::GIN = 0.07
@@ -3,7 +3,7 @@ BEGIN {
$DBIx::Class::KiokuDB::EntryProxy::AUTHORITY = 'cpan:NUFFIN';
}
BEGIN {
- $DBIx::Class::KiokuDB::EntryProxy::VERSION = '1.15';
+ $DBIx::Class::KiokuDB::EntryProxy::VERSION = '1.18';
}
use strict;
@@ -3,7 +3,7 @@ BEGIN {
$DBIx::Class::KiokuDB::AUTHORITY = 'cpan:NUFFIN';
}
BEGIN {
- $DBIx::Class::KiokuDB::VERSION = '1.15';
+ $DBIx::Class::KiokuDB::VERSION = '1.18';
}
use strict;
@@ -3,7 +3,7 @@ BEGIN {
$DBIx::Class::Schema::KiokuDB::AUTHORITY = 'cpan:NUFFIN';
}
BEGIN {
- $DBIx::Class::Schema::KiokuDB::VERSION = '1.15';
+ $DBIx::Class::Schema::KiokuDB::VERSION = '1.18';
}
use strict;
@@ -14,7 +14,7 @@ use Carp qw(croak);
use DBIx::Class::KiokuDB::EntryProxy;
use DBIx::Class::ResultSource::Table;
-use Scalar::Util qw(weaken);
+use Scalar::Util qw(weaken refaddr);
use namespace::clean;
@@ -5,7 +5,7 @@ BEGIN {
$KiokuDB::Backend::DBI::Schema::AUTHORITY = 'cpan:NUFFIN';
}
BEGIN {
- $KiokuDB::Backend::DBI::Schema::VERSION = '1.15';
+ $KiokuDB::Backend::DBI::Schema::VERSION = '1.18';
}
use Moose;
@@ -5,7 +5,7 @@ BEGIN {
$KiokuDB::Backend::DBI::AUTHORITY = 'cpan:NUFFIN';
}
BEGIN {
- $KiokuDB::Backend::DBI::VERSION = '1.15';
+ $KiokuDB::Backend::DBI::VERSION = '1.18';
}
use Moose;
@@ -887,24 +887,43 @@ sub search {
);
my %spec = $query->extract_values($self);
+ my @binds;
- my @v = @{ $spec{values} };
+ my $inner_sql = $self->_search_gin_subquery(\%spec, \@binds);
+ return $self->_select_entry_stream("SELECT data FROM entries WHERE id IN (".$inner_sql.")",@binds);
+}
+
+sub _search_gin_subquery {
+ my ($self, $spec, $binds) = @_;
+
+ my @v = ref $spec->{values} eq 'ARRAY' ? @{ $spec->{values} } : ();
+ if ( $spec->{method} eq 'set' ) {
+ my $op = $spec->{operation};
+
+ die 'gin set query received bad operation'
+ unless $op =~ /^(UNION|INTERSECT|EXCEPT)$/i;
- if ( $spec{method} eq 'all' and @v > 1) {
+ die 'gin set query missing subqueries'
+ unless ref $spec->{subqueries} eq 'ARRAY' &&
+ scalar @{ $spec->{subqueries} };
+
+ return "(".
+ (
+ join ' '.$op.' ',
+ map { $self->_search_gin_subquery($_, $binds) }
+ @{ $spec->{subqueries} }
+ ).")";
+
+ } elsif ( $spec->{method} eq 'all' and @v > 1) {
# for some reason count(id) = ? doesn't work
- return $self->_select_entry_stream("
- SELECT data FROM entries WHERE id IN (
- SELECT id FROM gin_index WHERE value IN (" . join(", ", ('?') x @v) . ") GROUP BY id HAVING COUNT(id) = " . scalar(@v) . "
- )",
- @v
- );
+ push @$binds, @v;
+ return "SELECT id FROM gin_index WHERE value IN ".
+ "(" . join(", ", ('?') x @v) . ")" .
+ "GROUP BY id HAVING COUNT(id) = " . scalar(@v);
} else {
- return $self->_select_entry_stream("
- SELECT data FROM entries WHERE id IN (
- SELECT DISTINCT id FROM gin_index WHERE value IN (" . join(", ", ('?') x @v) . ")
- )",
- @v
- );
+ push @$binds, @v;
+ return "SELECT DISTINCT id FROM gin_index WHERE value IN ".
+ "(" . join(", ", ('?') x @v) . ")";
}
}
@@ -3,7 +3,7 @@ BEGIN {
$KiokuDB::TypeMap::Entry::DBIC::ResultSet::AUTHORITY = 'cpan:NUFFIN';
}
BEGIN {
- $KiokuDB::TypeMap::Entry::DBIC::ResultSet::VERSION = '1.15';
+ $KiokuDB::TypeMap::Entry::DBIC::ResultSet::VERSION = '1.18';
}
use Moose;
@@ -3,7 +3,7 @@ BEGIN {
$KiokuDB::TypeMap::Entry::DBIC::ResultSourceHandle::AUTHORITY = 'cpan:NUFFIN';
}
BEGIN {
- $KiokuDB::TypeMap::Entry::DBIC::ResultSourceHandle::VERSION = '1.15';
+ $KiokuDB::TypeMap::Entry::DBIC::ResultSourceHandle::VERSION = '1.18';
}
use Moose;
@@ -3,7 +3,7 @@ BEGIN {
$KiokuDB::TypeMap::Entry::DBIC::Row::AUTHORITY = 'cpan:NUFFIN';
}
BEGIN {
- $KiokuDB::TypeMap::Entry::DBIC::Row::VERSION = '1.15';
+ $KiokuDB::TypeMap::Entry::DBIC::Row::VERSION = '1.18';
}
use Moose;
@@ -3,7 +3,7 @@ BEGIN {
$KiokuDB::TypeMap::Entry::DBIC::Schema::AUTHORITY = 'cpan:NUFFIN';
}
BEGIN {
- $KiokuDB::TypeMap::Entry::DBIC::Schema::VERSION = '1.15';
+ $KiokuDB::TypeMap::Entry::DBIC::Schema::VERSION = '1.18';
}
use Moose;
@@ -0,0 +1,88 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Scalar::Util qw(refaddr);
+use Test::More;
+use Test::Exception;
+use Search::GIN::Query::Set;
+use Search::GIN::Query::Manual;
+use Search::GIN::Extract::Callback;
+use KiokuDB;
+
+use constant TESTDB => 't/set_query.db';
+sub cleanup { unlink TESTDB }
+
+BEGIN {
+ plan skip_all => "DBD::SQLite are required" unless eval { require DBI; require DBD::SQLite };
+}
+
+END {
+ cleanup;
+}
+
+{ package TestClass;
+ use Moose;
+ has a => (is => 'rw');
+ has b => (is => 'rw');
+ has c => (is => 'rw');
+ has d => (is => 'rw');
+}
+
+cleanup;
+my $kiokudb = KiokuDB->connect
+ ( 'dbi:SQLite:'.TESTDB,
+ create => 1,
+ extract =>
+ Search::GIN::Extract::Callback->new
+ ( extract => sub {
+ my ($obj) = @_;
+ return
+ { a => $obj->a,
+ b => $obj->b,
+ c => $obj->c,
+ d => $obj->d };
+ })
+ );
+
+{ my @a = 'a'..'e';
+ my @b = 'f'..'j';
+ my @c = 'k'..'o';
+ my @d = 'p'..'t';
+ my $s = $kiokudb->new_scope;
+ $kiokudb->store(map { TestClass->new( a => $a[$_],
+ b => $b[$_],
+ c => $c[$_],
+ d => $d[$_] )
+ } 0..4);
+};
+
+# now we can, finally, do some searches...
+# we're going to ask for:
+
+lives_ok {
+ # 1: (a:a or a:b or a:e) INTERSECT (c:k and d:p)
+ # should return just the object with a=a
+ my $results = $kiokudb->search
+ ( Search::GIN::Query::Set->new
+ ( operation => 'INTERSECT',
+ subqueries =>
+ [ Search::GIN::Query::Manual->new
+ ( values =>
+ { a => [qw(a b e)] }
+ ),
+ Search::GIN::Query::Manual->new
+ ( values =>
+ { c => 'k', d => 'p' },
+ method => 'all',
+ )
+ ]));
+ my $item = $results->next;
+ my @objects = @$item;
+ is(scalar @objects, 1, 'one object in the bulk');
+ is($objects[0]->a, 'a', 'Found the correct object');
+ ok(!$results->next, 'no more posts');
+};
+
+done_testing();